<%-- 
    Document   : flightManage
    Created on : Aug 31, 2011, 8:51:08 PM
    Author     : HIEP
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<script>
    function confirmDelete(){
        return confirm("Are you sure want delete?");
    }    
</script>

<!DOCTYPE html>
<div id="content" class="roundedBorders">
    <div id="titleActions">
        <div class="newPost actionBlock">
            <html:link action="/FlightAction.do?method=addFlight" styleClass="button">
                <strong>
                    <img class="icon " alt="" src="images/icons/add_48.png"/>
                    Add New Flight</strong>
                </html:link>
        </div>
    </div>
    <!-- Title -->
    <div id="title" class="b2">
        <h2>Manage Flights</h2>
    </div>

    <!-- Title -->
    <!-- Inner Content -->
    <div id="innerContent">
        <p class="intro">
            List Flights!
        </p>

        <!-- ListTable -->
        <table cellspacing="0" class="listTable" id="postList">
            <!-- Thead -->
            <thead>
                <tr>
                    <th class="first"><div></div></th>
            <th><a href="#" title="Post">Name</a></th>
            <th><a href="#" title="Post">Departure City</a></th>
            <th><a href="#" title="Post">Departure Time</a></th>
            <th><a href="#" title="Post">Arrival City</a></th>
            <th><a href="#" title="Post">Arrival Time</a></th>
            <th class="last"a colspan="2"><a href="#" title="Date">Action</a></th>
            </tr>
            </thead>
            <!-- /Thead -->
            <!-- Tfoot -->
            <tfoot>
                <tr>
                    <td colspan="8">
                        <div class="inner">
                            <div class="paginate">
                            </div>
                        </div>
                    </td>
                </tr>
            </tfoot>
            <!-- /Tfoot -->
            <!-- Tbody -->
            <tbody>
                <c:if test="${list != null}">
                    <c:forEach items="${list}" var="item">
                        <tr>
                            <td><input type="checkbox" class="checkbox"/></td>
                            <td>${item.name}</td>
                            <td> 
                                <c:forEach items="${locationList}" var="loca">
                                    <c:if test="${loca.id == item.departure_city}">
                                        <c:out value="${loca.name}"/>
                                    </c:if>
                                </c:forEach>
                            </td>
                            <td>${item.departure_time}</td>
                            <td>
                                <c:forEach items="${locationList}" var="loca">
                                    <c:if test="${loca.id == item.arrival_city}">
                                        <c:out value="${loca.name}"/>
                                    </c:if>
                                </c:forEach>
                            </td>
                            <td>${item.arrival_time}</td>
                            <td> <html:link action="/FlightAction.do?method=edit&id=${item.id}">Edit</html:link>
                                <td class="last">
                                <html:link action="/FlightAction.do?method=delete&id=${item.id}" onclick="return confirmDelete();">Delete</html:link>
                                </td>
                            </tr>
                    </c:forEach>
                </c:if>
            </tbody>
            <!-- /Tbody -->
        </table>
        <!-- /ListTable -->	
    </div>
    <!-- /Inner Content -->
    <div class="bBottom"><div></div></div>
</div>




